﻿@typeparam TItem
@typeparam TValue
<Dropdown @ref="@dropdownRef" ElementId="@ElementId" Class="@Class" Style="@Style" RightAligned="@RightAligned" Disabled="@Disabled" Direction="@Direction" Attributes="@Attributes">
    <DropdownToggle @ref="@dropdownToggleRef" Color="@Color" TabIndex="@TabIndex">@ChildContent</DropdownToggle>
    <DropdownMenu>
        @if ( Data != null )
        {
            foreach ( var item in Data )
            {
                var text = TextField?.Invoke( item );
                var value = ValueField != null ? ValueField.Invoke( item ) : default;

                <DropdownItem Clicked="@HandleDropdownItemClicked" Value="@value">@text</DropdownItem>
            }
        }
    </DropdownMenu>
</Dropdown>

